package com.cuckoo.cuckoo_app2.business.Imp;

import com.cuckoo.cuckoo_app2.MyApplication;
import com.cuckoo.cuckoo_app2.business.VersionControlBusiness;
import com.cuckoo.cuckoo_app2.dao.VersionControl;
import com.cuckoo.cuckoo_app2.greendao.DaoSession;
import com.cuckoo.cuckoo_app2.greendao.VersionControlDao;

public class VersionControlBusinessImp implements VersionControlBusiness {

    @Override
    public void insert(VersionControl versionControl) {
        DaoSession db = MyApplication.getInstances().getDaoSession();
        db.getVersionControlDao().insert(versionControl);
    }

    @Override
    public void update(VersionControl versionControl) {
        DaoSession db = MyApplication.getInstances().getDaoSession();
        db.getVersionControlDao().update(versionControl);
    }

    @Override
    public String getValueControl(String name) {
        DaoSession db = MyApplication.getInstances().getDaoSession();
        VersionControl versionControl = db.getVersionControlDao().queryBuilder().where(VersionControlDao.Properties.Name.eq(name)).build().unique();
        return versionControl.getValue();
    }

}
